using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace CubicFWNet.Data.Models.Mapping
{
    public class InvoiceMap : EntityTypeConfiguration<Invoice>
    {
        public InvoiceMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Number)
                .HasMaxLength(64);

            this.Property(t => t.CreatorName)
                .HasMaxLength(64);

            this.Property(t => t.Memo)
                .HasMaxLength(256);

            this.Property(t => t.ExamineMemo)
                .HasMaxLength(256);

            this.Property(t => t.DliveryDemand)
                .HasMaxLength(256);

            this.Property(t => t.Carrier)
                .HasMaxLength(128);

            this.Property(t => t.TakeCompany)
                .HasMaxLength(128);

            this.Property(t => t.SendPeople)
                .HasMaxLength(64);

            this.Property(t => t.ReceivePeople)
                .HasMaxLength(64);

            this.Property(t => t.StoreName)
                .HasMaxLength(64);

            // Table & Column Mappings
            this.ToTable("Invoice");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.OrderId).HasColumnName("OrderId");
            this.Property(t => t.CreatorId).HasColumnName("CreatorId");
            this.Property(t => t.CreatorName).HasColumnName("CreatorName");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.ApplyTime).HasColumnName("ApplyTime");
            this.Property(t => t.ApplyId).HasColumnName("ApplyId");
            this.Property(t => t.Memo).HasColumnName("Memo");
            this.Property(t => t.DliveryDemand).HasColumnName("DliveryDemand");
            this.Property(t => t.Carrier).HasColumnName("Carrier");
            this.Property(t => t.TakeCompany).HasColumnName("TakeCompany");
            this.Property(t => t.Data).HasColumnName("Data");
            this.Property(t => t.DataBack).HasColumnName("DataBack");
            this.Property(t => t.SendPeople).HasColumnName("SendPeople");
            this.Property(t => t.ReceivePeople).HasColumnName("ReceivePeople");
            this.Property(t => t.StoreType).HasColumnName("StoreType");
            this.Property(t => t.StoreName).HasColumnName("StoreName");
            this.Property(t => t.DliveryTime).HasColumnName("DliveryTime");
            this.Property(t => t.ReceivedTime).HasColumnName("ReceivedTime");
            this.Property(t => t.ExamineMemo).HasColumnName("ExamineMemo");
        }
    }
}
